<?php
	$title='消费记录';
	require_once $_site->get_viewpath("wap/commom/header");
	$user_info = $user_data;
	if(!$user_info){
		?>
		<script language="JavaScript" type="text/javascript">
			window.location.href="/wap/login";
		</script>
		<?php
	}
	require_once $_site->get_handlepath('user');
	//require_once $_site->get_handlepath('city');
	//require_once $_site->get_handlepath('order');
	//$page=request('page',false,true,false,1);
	//$pagesize=request('pagesize',false,true,false,10);
	$data['type']=$type=request('type',false,true,false,2);
	//$data['uid'] = $user_info['id'];
	//$result=user_fun_get_logs_list($data,$page,$pagesize);
	$hover[$data['type']]=' class="hover" ';
	//$point_type=array(0=>'全部',1=>'<tt class="red">兑换</tt>',2=>'<tt class="green">消费</tt>');
	//$page_type=array(0=>'全部',1=>'积分兑换',2=>'现金消费');
?>
<script type="text/javascript" language="javascript" src="/static/wap/js/page.js?cmd=1"></script>
<script type="text/javascript" language="javascript">
	window.onload=function (){

		var page_obj = pageObj({
			parm:{
				h:'user/log_record',
				type:'<?php echo $type ;?>',
				pagesize:15
			},
			success:function (data){
				var tpl = page_obj.config['parm'].type == 2 ?
							pageObj.money_html_tpl	:
							pageObj.jifen_html_tpl	;

				if(data.state && data.list['rows']!=false){
					var list = data.list['rows'],str='';
					if(page_obj.config['parm'].type == 2){//现金消费
						for(var i in list){
							var tmpHtml = tpl.replace(/(.*)r_obj(.*)r_time(.*)r_money(.*)r_point(.*)r_s_name(.*)r_city_name(.*)/g, "$1"+list[i].obj+"$2"+page_obj.Time(list[i].create_time)+"$3"+list[i].money+"$4"+list[i].point+"$5"+list[i].s_name+"$6"+list[i].city_name+"$7");

							str += tmpHtml;
						}
					}else{
						for(var i in list){
							var tmpHtml = tpl.replace(/(.*)r_obj(.*)r_time(.*)r_point(.*)r_s_name(.*)r_city_name(.*)/g, "$1"+list[i].obj+"$2"+page_obj.Time(list[i].create_time)+"$3"+list[i].point+"$4"+list[i].s_name+"$5"+list[i].city_name+"$6");

							str += tmpHtml;
						}
					}

					$(page_obj.config['dataBox']).append(str);
				}else{

					page_obj._removeEvent();
					$('#no-data').show();
				}
				if(parseInt(data.list['cur_page']) == parseInt(data.list['page_count'])){
					page_obj._removeEvent();

				}
			}
		}).send();
	}
</script>
<body style=" padding-bottom:50px;">
	<div class="top_one"><a href="/wap/index" class="arrow_carrot-left return"></a>消费记录<a href="/wap/info" class="icon_profile person"></a></div>
	<div class="jf_top">
		<ul>

			<li><a <?php echo $hover[2];?> href="/wap/xiaofei&type=2">现金消费记录</a></li>
			<li><a <?php echo $hover[1];?> href="/wap/xiaofei&type=1">积分兑换记录</a></li>
		</ul>
	</div>
	<div class="jf_main">
		<div id='no-data' style="display: none; text-align:center; font-size:14px; padding:10px 0px;">暂无数据</div>
		<?php
		/*if($result['rows']){
			foreach ($result['rows'] as $v ){
				if($type == 2){ //现金消费记录
				?>
				<div class="xf_info">
					<div class="xf_info_top"><?php echo $v['obj'];?><span><?php echo $v['create_time']?date('Y-m-d H:i',$v['create_time']):"--";?></span></div>
					<div class="xf_info_bottom">
						<ul>
							<li><p>消费金额</p><span>￥<?php echo (float)$v['money'];?></span></li>
							<li style=" background-image:none;"><p>获得积分</p><span><?php echo $v['point'];?></span></li>
						</ul>
						<div class="other">
							<p>消费店铺： <?php echo $v['s_name'];?></p>
							<span>消费区域： <?php echo $v['city_name'];?></span>
						</div>
					</div>
				</div>
				<?php
				}elseif($type==1){//兑换记录
					?>
					<div class="jf_info">
						<div class="jf_info_top"><?php echo $v['obj'];?><span><?php echo $v['create_time']?date('Y-m-d H:i',$v['create_time']):"--";?></span></div>
						<div class="jf_info_bottom">
							<ul>

								<li style=" background-image:none;"><p>兑换积分</p><span>-<?php echo $v['point'];?></span></li>
							</ul>
							<div class="other">
								<p>兑换店铺： <?php echo $v['s_name'];?></p>
								<span>兑换区域： <?php echo $v['city_name'];?></span>
							</div>
						</div>
					</div>
					<?php
				}
			}
		}*/
		?>


	</div>
	<div class="more" >
		<span id='page'>加载更多>></span>
	</div>

	<?php require_once $_site->get_viewpath("wap/commom/bottom");?>
</body>
</html>
